﻿using EntityModel.CommodityMent;
using EntityModel.Customers;
using EntityModel.Procurement;
using EntityModel.Product;
using EntityModel.Quotation;
using EntityModel.User;
using EntityModel.Warehouse;
using Microsoft.EntityFrameworkCore;
using System;
using System.Collections.Generic;
using System.Text;

namespace EntityModel.Helper
{
    public class RoutineDbContext : DbContext
    {
        public RoutineDbContext(DbContextOptions<RoutineDbContext> options) : base(options)
        {

        }

        #region 实体数据 ================================================

        #region 用户模块
        /// <summary>
        /// 用户表
        /// </summary>
        public DbSet<AikeApplet_Members> _Members { get; set; }

        /// <summary>
        /// 用户角色表
        /// </summary>
        public DbSet<AikeApplet_UsersRole> _UsersRoles { get; set; }
        /// <summary>
        /// 角色表
        /// </summary>
        public DbSet<AikeApplet_Roles> _Roles { get; set; }
        #endregion

        #region 商品管理模块
        /// <summary>
        /// 商品表
        /// </summary>
        public DbSet<AikeApplet_goods> _Goods { get; set; }
        /// <summary>
        /// 商品评价表
        /// </summary>
        public DbSet<AikeApplet_goods_appraises> _Goods_Appraises { get; set; }
        /// <summary>
        /// 商品属性表
        /// </summary>
        public DbSet<AikeApplet_goods_attributes> _Goods_Attributes { get; set; }
        /// <summary>
        /// 商品分类表
        /// </summary>
        public DbSet<AikeApplet_goods_cats> _Goods_Cats { get; set; }
        /// <summary>
        /// 商品咨询表
        /// </summary>
        public DbSet<AikeApplet_goods_consult> _Goods_Consults { get; set; }
        /// <summary>
        /// 商品评分表
        /// </summary>
        public DbSet<AikeApplet_goods_scores> _Goods_Scores { get; set; }
        /// <summary>
        /// 商品规格表
        /// </summary>
        public DbSet<AikeApplet_goods_specs> _Goods_Specs { get; set; }
        /// <summary>
        /// 商品虚拟表
        /// </summary>
        public DbSet<AikeApplet_goods_virtuals> _Goods_Virtuals { get; set; }
        #endregion

        #region 报价单模块

        /// <summary>
        /// 报价单
        /// </summary>
        public DbSet<AikeApplet_QuotePrice> _QuotePrices { get; set; }

        /// <summary>
        /// 报价单详情
        /// </summary>
        public DbSet<AikeApplet_QuotePriceDetail> _QuotePriceDetails { get; set; }

        /// <summary>
        /// 报损单
        /// </summary>
        public DbSet<AikeApplet_Losts> _Losts { get; set; }

        /// <summary>
        /// 报损单详情
        /// </summary>
        public DbSet<AikeApplet_LostDetail> _LostDetails { get; set; }

        /// <summary>
        /// 报溢单
        /// </summary>
        public DbSet<AikeApplet_PayOffs> _PayOffs { get; set; }

        /// <summary>
        /// 报溢单详情
        /// </summary>
        public DbSet<AikeApplet_PayOffDetail> _PayOffDetails { get; set; }
        #endregion

        #region 采购单模块
        /// <summary>
        /// 采购单
        /// </summary>
        public DbSet<AikeApplet_Stocks> _Stocks { get; set; }

        /// <summary>
        /// 采购单详情
        /// </summary>
        public DbSet<AikeApplet_StockDetail> _StockDetail { get; set; }

        /// <summary>
        /// 采购单入库
        /// </summary>
        public DbSet<AikeApplet_StockInDepot> _StockInDepots { get; set; }
        #endregion

        #region 仓库模块
        /// <summary>
        /// 仓库
        /// </summary>
        public DbSet<AikeApplet_Depots> _Depots { get; set; }

        /// <summary>
        /// 仓库调拨单
        /// </summary>
        public DbSet<AikeApplet_Devolves> _Devolves { get; set; }
        /// <summary>
        /// 仓库调拨单详情
        /// </summary>
        public DbSet<AikeApplet_DevolveDetail> _DevolveDetails { get; set; }

        #endregion

        #region 供货商模块
        /// <summary>
        /// 供货商
        /// </summary>
        public DbSet<AikeApplet_ProductLend> _ProductLends { get; set; }
        #endregion

        #region 客户
        /// <summary>
        /// 客户表
        /// </summary>
        public DbSet<AikeApplet_Customers> _Customers { get; set; }
        #endregion

        #endregion

        #region 封装实体 ================================================
        protected override void OnModelCreating(ModelBuilder modelBuilder)
        {
            #region 用户
            modelBuilder.Entity<AikeApplet_Members>().ToTable("Members");
            modelBuilder.Entity<AikeApplet_UsersRole>().ToTable("UsersRole");
            modelBuilder.Entity<AikeApplet_Roles>().ToTable("Roles");
            #endregion

            #region 商品管理模块
            modelBuilder.Entity<AikeApplet_goods>().ToTable("goods");
            modelBuilder.Entity<AikeApplet_goods_appraises>().ToTable("goods_appraises");
            modelBuilder.Entity<AikeApplet_goods_attributes>().ToTable("goods_attributes");
            modelBuilder.Entity<AikeApplet_goods_cats>().ToTable("goods_cats");
            modelBuilder.Entity<AikeApplet_goods_consult>().ToTable("goods_consult");
            modelBuilder.Entity<AikeApplet_goods_scores>().ToTable("goods_scores");
            modelBuilder.Entity<AikeApplet_goods_specs>().ToTable("goods_specs");
            modelBuilder.Entity<AikeApplet_goods_virtuals>().ToTable("goods_virtuals");
            #endregion

            #region 报价单 
            modelBuilder.Entity<AikeApplet_QuotePrice>().ToTable("QuotePrice");
            modelBuilder.Entity<AikeApplet_QuotePriceDetail>().ToTable("QuotePriceDetail");
            modelBuilder.Entity<AikeApplet_PayOffs>().ToTable("PayOffs");
            modelBuilder.Entity<AikeApplet_PayOffDetail>().ToTable("PayOffDetail");
            modelBuilder.Entity<AikeApplet_Losts>().ToTable("Losts");
            modelBuilder.Entity<AikeApplet_LostDetail>().ToTable("LostDetail");
            #endregion

            #region 采购
            modelBuilder.Entity<AikeApplet_Stocks>().ToTable("Stocks");
            modelBuilder.Entity<AikeApplet_StockDetail>().ToTable("StockDetail");
            modelBuilder.Entity<AikeApplet_StockInDepot>().ToTable("StockInDepot");
            #endregion

            #region 仓库
            modelBuilder.Entity<AikeApplet_Depots>().ToTable("Depots");
            modelBuilder.Entity<AikeApplet_Devolves>().ToTable("Devolves");
            modelBuilder.Entity<AikeApplet_DevolveDetail>().ToTable("DevolveDetail");
            #endregion

            #region 客户
            modelBuilder.Entity<AikeApplet_Customers>().ToTable("Customers");
            #endregion

            #region 供货商
            modelBuilder.Entity<AikeApplet_ProductLend>().ToTable("ProductLend");
            #endregion

        }
        #endregion

    }
}
